from quote.base.browseroperation import BrowserOperation
from quote.base.usebrowser import UseBrowser


class LoginPage:

    def __init__(self):
        self.ub = UseBrowser()
        self.bo = BrowserOperation(UseBrowser.driver)

    #登录
    def login(self,username='',password=''):
        self.bo.open_url("http://localhost:8080/JavaPrj_6/")
        self.bo.input_text('name', 'username',username)
        self.bo.input_text('name', 'password',password)
        self.bo.click_element('name', 'submit')

    def get_suc_info(self):
        self.bo.change_frame('main')
        text=self.bo.get_text('xpath','/html/body/table/tbody/tr[1]/td/span')
        return text

    def get_fail_info(self):
        text=self.bo.get_text('xpath','/html/body/table/tbody/tr[1]/td[2]/form/table/tbody/tr[5]/td')
        return text
# if __name__ == '__main__':
#     lg=LoginPage()
#     lg.login()